﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DreamBuilder.Common;
using ePlanet.ArchiveMange.Services;
using ePlanet.ArchiveMange.Models;
using ePlanet.ArchiveMange.DataAccess;
using System.Data;
namespace ePlanet.ArchiveMange.Business
{
    public class BUSDocumentArchive : BusinessBase, IDocumentArchiveService
    {
        DocumentArchiveDAL dal = new DocumentArchiveDAL();
        ArchiveCommon commonDal = new ArchiveCommon();
        #region IDocumentArchiveService 成员

        
        public ArchiveMangeModal.DOCUMENT_ARCHIVEDataTable GetAllDocumenArchivetData()
        {
           return dal.GetAllDocumenArchivetData();
        }

        public ArchiveMangeModal.DOCUMENT_ARCHIVEDataTable GetAllDocumenArchivetDataById(string DATAID)
        {
            return dal.GetAllDocumenArchivetDataById(DATAID);
        }

        /// <summary>
        /// 备注：根据DATAID列表取对应档案的详细信息
        /// 时间：2013年1月9日 23:47:41
        /// </summary>
        /// <param name="idList"></param>
        /// <returns></returns>
        public DataTable GetDocumentArchiveDataByIds(IEnumerable<string> idList)
        {
            return dal.GetDocumentArchiveDataByIds(idList);
        }

        /// <summary>
        /// 备注：取交接文具数据
        /// 时间：2013年4月19日 20:48:55
        /// </summary>
        /// <param name="idList"></param>
        /// <returns></returns>
        public DataTable GetHandoverDataByIds(IEnumerable<string> idList)
        {
            return dal.GetHandoverDataByIds(idList);
        }

        /// <summary>
        /// 备注：取档案所属年度
        /// 时间：2013年5月9日 23:22:44
        /// </summary>
        /// <param name="idList"></param>
        /// <returns></returns>
        public DataTable GetArchiveDateSpanByIds(IEnumerable<string> idList)
        {
            return dal.GetArchiveDateSpanByIds(idList);
        }

        public DataTable GetDataIdByArchiveCodeRange(string startCode, string endCode)
        {
            return dal.GetDataIdByArchiveCodeRange(startCode, endCode);
        }

           /// <summary>
            /// 根据档案类型查询数据
            /// </summary>
            /// <param name="typeId"></param>
            /// <returns></returns>
        public ArchiveMangeModal.DOCUMENT_ARCHIVEDataTable GetArchiveByType(string archiveType)
        {
            return dal.GetArchiveByType(archiveType);
        }
        #endregion

        #region IArchiveBase 成员
        public bool SaveData(DataSet ds)
        {
            return commonDal.SaveData(ds);
        }

        public bool SaveAttach(DataTable dt_Attach, string objectTableName, string objectID, string DBHelperString)
        {
            return commonDal.SaveAttach(dt_Attach, objectTableName, objectID, DBHelperString);
        }

        
        public DataSet GetAttach(string ObjectID, string DBHelperString)
        {
            return commonDal.GetAttach(ObjectID, DBHelperString);
        }

        /// <summary>
        /// 根据主键删除数据
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public bool DeleteData(string key)
        {
            return dal.DeleteData(key);
        }
        #endregion

        #region IDocumentArchiveService 成员

        /// <summary>
        /// 根据档案类型和userid获取数据
        /// </summary>
        /// <param name="archiveType"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public ArchiveMangeModal.DOCUMENT_ARCHIVEDataTable GetTypeArchiveByUserId(string archiveType, string userId)
        {
            return dal.GetTypeArchiveByUserId(archiveType, userId);
        }

        #endregion


        public bool IsSameSecret(List<Guid> dataIDList)
        {
            return dal.IsSameSecret(dataIDList);
        }

        public byte[] GetAttachContentByID(string dataID, string DBHelperString)
        {
            return this.commonDal.GetAttachContentByID(dataID, DBHelperString);
        }
    }
}
